package com.puhui.education.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.puhui.education.R;
import com.puhui.education.bean.CourseLittleInfo;
import com.zhy.android.percent.support.PercentLinearLayout;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2016/5/27.
 */
public class CourseIntroductionView extends PercentLinearLayout {
    @Bind(R.id.iv_img_courseIntroductionView)
    ImageView iv_img;
    @Bind(R.id.tv_name_courseIntroductionView)
    TextView tv_name;
    @Bind(R.id.tv_explanation_courseIntroductionView)
    TextView tv_explanation;

    public CourseIntroductionView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initCourseIntroductionView(context);
    }

    private void initCourseIntroductionView(Context context) {
        View view = LayoutInflater.from(context).inflate(R.layout.cv_course_introduction, this);
        ButterKnife.bind(view);
    }

    public void setCourseIntroductionInfo(CourseLittleInfo info) {
        iv_img.setImageResource(info.getImgResourceId());
        tv_name.setText(info.getName());
        tv_explanation.setText(info.getExplanation());
    }
    public void setTextViewTextSize(float textSize1, float textSize2){
        tv_name.setTextSize(textSize1);
        tv_explanation.setTextSize(textSize2);
    }
}
